<?php
function unlimitedForLevel ($cate, $html = '--', $pid = 0, $level = 0,$space='&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;') {
    $arr = array();
    foreach ($cate as $k => $v) {
        if ($v['parent_id'] == $pid) {
            $val['level'] = $level + 1;
            $val['html']  = str_repeat($html, $level);
            $val['id']    = $v['id'];
            $val['name']        = $v['name'];
            $val['mobile_name'] = $v['mobile_name'];
            $val['parent_id']   = $v['parent_id'];
            $val['parent_id_path'] = $v ['parent_id_path'];
            $val['sort_order']   =  $v['sort_order'];
            $val['is_show']      =  $v['is_show'];
            $val['image']        =  $v['image'];
            $val['cat_sketch']   =  $v['cat_sketch'];
            $val['space']=str_repeat($space, $level);
            $arr[] = $val;
            $arr = array_merge($arr,unlimitedForLevel($cate, $html, $v['id'], $level + 1));
        }
    }
    return $arr;
}

//追加网站日志内容
function addLog2($msg){
    $adminlog = db('admin_log')->where('id='.session('log_id'))->find();
    if($adminlog){
        $log_arr = json_decode($adminlog['content'],true);
        $temp['alt'] = $msg;
        $temp['time'] = time();
        $log_arr[] = $temp;
        $logdata['content'] = json_encode($log_arr);
        db('admin_log')->where('id='.session('log_id'))->update($logdata);
    }
}